package com.estore.action;

import java.util.List;

import com.estore.info.BrandInfo;
import com.estore.info.CatInfo;
import com.estore.info.SubCatInfo;
import com.estore.manager.ProductManager;
import com.estore.manager.ProfileManager;
import com.estore.model.ProductModel;
import com.estore.model.ProfileModel;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class LinkAction extends ActionSupport implements
		ModelDriven<ProductModel> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 950279949692200212L;
	ProductModel productModel = new ProductModel();
	ProfileModel profileModel = new ProfileModel();
	ProductManager productManager;
	ProfileManager profileManager;

	public String detailCategoriesLink() {
		List<SubCatInfo> listSubcat = productManager.listSubCatInfo();
		List<CatInfo> catInfo = productManager.listCatInfo();
		productModel.setListSubcat(listSubcat);
		productModel.setListCatInfo(catInfo);
		return SUCCESS;
	}

	public String categoriesLink() {
		List<SubCatInfo> listSubcat = productManager.listSubCatInfo();
		List<CatInfo> catInfo = productManager.listCatInfo();
		productModel.setListSubcat(listSubcat);
		productModel.setListCatInfo(catInfo);
		return SUCCESS;
	}

	public String addModeratorLink() {
		return SUCCESS;
	}

	public String loginLink() {
		return "success";
	}

	public String regLink() {
		return "success";
	}

	public String homepageLink() {
		return "success";
	}

	public String adminpageLink() {
		return "success";
	}

	public String addProductLink() {
		List<SubCatInfo> listSubcat = productManager.listSubCatInfo();
		List<CatInfo> catInfo = productManager.listCatInfo();
		productModel.setListSubcat(listSubcat);
		productModel.setListCatInfo(catInfo);
		List<BrandInfo> brandInfo = productManager.getListBrand();
		if (brandInfo != null) {
			productModel.setListBrandInfo(brandInfo);
		}
		return "success";
	}

	public String addBrandLink() {
		productModel.setTabActive1("active");
		productModel.setTabActive2(null);
		List<BrandInfo> brandInfo = productManager.getListBrand();
		if (brandInfo != null) {
			productModel.setListBrandInfo(brandInfo);
		}
		return "success";
	}

	public String detailBrandLink() {
		List<BrandInfo> brandInfo = productManager.getListBrand();
		if (brandInfo != null) {
			productModel.setListBrandInfo(brandInfo);
		}
		return SUCCESS;
	}

	@Override
	public ProductModel getModel() {
		// TODO Auto-generated method stub
		return null;
	}

	public ProductModel getProductModel() {
		return productModel;
	}

	public void setProductModel(ProductModel productModel) {
		this.productModel = productModel;
	}

	public ProfileModel getProfileModel() {
		return profileModel;
	}

	public void setProfileModel(ProfileModel profileModel) {
		this.profileModel = profileModel;
	}

	public ProductManager getProductManager() {
		return productManager;
	}

	public void setProductManager(ProductManager productManager) {
		this.productManager = productManager;
	}

	public ProfileManager getProfileManager() {
		return profileManager;
	}

	public void setProfileManager(ProfileManager profileManager) {
		this.profileManager = profileManager;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
